"""
该文件用于 封装界面
"""
import uiautomation as auto
from utils.utils_log import loggerCase
from page.base_page import BasePage

class MeshPage(BasePage):
    """封装页面"""

    # 优化封装按钮
    __optMesh_button = auto.GroupControl(SubName="optMesh")

    # 普通封装按钮
    __mesh_button = auto.GroupControl(SubName="mesh")

    # 封装选择
    __triangle_button = auto.GroupControl(SubName="triangle")

    # 无优化
    __optimization_none = auto.RadioButtonControl(name="None")

    # 优化标准
    __optimization_standard = auto.RadioButtonControl(Name="Standard")

    # 优化中
    __optimization_med = auto.RadioButtonControl(Name="Med", foundIndex=1)

    # 优化高
    __optimization_high = auto.RadioButtonControl(Name="High", foundIndex=1)

    # 平滑低
    __smooth_low = auto.RadioButtonControl(Name="Low")

    # 平滑中
    __smooth_med = auto.RadioButtonControl(Name="med", foundIndex=2)

    # 平滑高
    __smooth_high = auto.RadioButtonControl(Name="High", foundIndex=2)

    # 边界最佳化
    __edge_optimization = auto.TextControl(SubName="access_Edge Optimization")

    # 最大面片数
    __max_triangles = auto.TextControl(SubName="access_Max triangles")

    # 补小洞
    __fill_small_hole = auto.TextControl(SubName="access_Fill Small Hole")

    # 去除尖刺
    __remove_spike = auto.TextControl(SubName="access_Remove Spike")

    # 标志点补洞
    __marker_hole_filling = auto.TextControl(SubName="access_Marker Hole Filling")

    # 推荐参数
    # __recommended_parameters = auto.TextControl(SubName="access_Recommended parameters").GetNextSiblingControl()

    def click_optMesh_button(self, max_wait_time=3):
        """选择优化封装"""
        loggerCase.info("选择优化封装")
        self.click(MeshPage.__optMesh_button, max_wait_time=max_wait_time)

    def click_mesh_method_button(self, max_wait_time=3):
        """选择普通封装"""
        loggerCase.info("选择普通封装")
        self.click(MeshPage.__mesh_button, max_wait_time=max_wait_time)

    def click_triangle_button(self, max_wait_time=3):
        """选择封装模式"""
        loggerCase.info("选择封装模式")
        self.click(MeshPage.__triangle_button, max_wait_time=max_wait_time)

    def click_optimization_none(self, max_wait_time=3):
        """选择无优化"""
        loggerCase.info("选择无优化")
        self.click(MeshPage.__optimization_none, max_wait_time=max_wait_time)

    def click_optimization_standard(self, max_wait_time=3):
        """选择标准优化"""
        loggerCase.info("选择标准优化")
        self.click(MeshPage.__optimization_standard, max_wait_time=max_wait_time)

    def click_optimization_med(self, max_wait_time=3):
        """选择优化中"""
        loggerCase.info("选择优化中")
        self.click(MeshPage.__optimization_med, max_wait_time=max_wait_time)

    def click_optimization_high(self, max_wait_time=3):
        """选择优化高"""
        loggerCase.info("选择优化高")
        self.click(MeshPage.__optimization_high, max_wait_time=max_wait_time)

    def click_smooth_low(self, max_wait_time=3):
        """选择平滑低"""
        loggerCase.info("选择平滑低")
        self.click(MeshPage.__smooth_low, max_wait_time=max_wait_time)

    def click_smooth_med(self, max_wait_time=3):
        """选择平滑中"""
        loggerCase.info("选择平滑中")
        self.click(MeshPage.__smooth_med, max_wait_time=max_wait_time)

    def click_smooth_high(self, max_wait_time=3):
        """选择平滑高"""
        loggerCase.info("选择平滑高")
        self.click(MeshPage.__smooth_high, max_wait_time=max_wait_time)

    def click_max_triangles(self, max_wait_time=3):
        """最大面片数"""
        loggerCase.info("点击最大面片数")
        self.click(self.__max_triangles, max_wait_time=max_wait_time)

    def click_fill_small_hole(self, max_wait_time=3):
        """补小洞"""
        loggerCase.info("点击补小洞")
        self.click(self.__fill_small_hole, max_wait_time=max_wait_time)

    def click_remove_spike(self, max_wait_time=3):
        """去除尖刺"""
        loggerCase.info("点击去除尖刺")
        self.click(self.__remove_spike, max_wait_time=max_wait_time)

    def click_marker_hole_filling(self, max_wait_time=3):
        """标志点补洞"""
        loggerCase.info("点击标志点补洞")
        self.click(self.__marker_hole_filling, max_wait_time=max_wait_time)

    def click_edge_optimization(self, max_wait_time=3):
        """边界优化"""
        loggerCase.info("点击边界优化")
        self.click(self.__edge_optimization, max_wait_time=max_wait_time)

    # def click_recommended_parameters(self, max_wait_time=3):
    #     """使用推荐参数"""
    #     loggerCase.info("使用推荐参数")
    #     self.click(self.__recommended_parameters, max_wait_time=max_wait_time)
